package com.yanqu.road.entity.minewar;

import com.yanqu.road.entity.player.UserPatrons;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

public class UserMinePit {

	private int mineType;

	private int pitId;

	private int stationId;

	private long userId;

	private List<Integer> patronsIdList;

	private long joinTime;

	private long lastGetRewardTime;

	private String decoration;           //装扮

	private String nickName;

	private String unionName;

	private BigInteger totalAbility = BigInteger.ZERO;           //总能力

	private List<UserPatrons> patronsList = new ArrayList<>();

	public int getMineType() {
		return mineType;
	}

	public void setMineType(int mineType) {
		this.mineType = mineType;
	}

	public int getPitId() {
		return pitId;
	}

	public void setPitId(int pitId) {
		this.pitId = pitId;
	}

	public int getStationId() {
		return stationId;
	}

	public void setStationId(int stationId) {
		this.stationId = stationId;
	}

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	public List<Integer> getPatronsIdList() {
		return patronsIdList;
	}

	public void setPatronsIdList(List<Integer> patronsIdList) {
		this.patronsIdList = patronsIdList;
	}

	public long getJoinTime() {
		return joinTime;
	}

	public void setJoinTime(long joinTime) {
		this.joinTime = joinTime;
	}

	public long getLastGetRewardTime() {
		return lastGetRewardTime;
	}

	public void setLastGetRewardTime(long lastGetRewardTime) {
		this.lastGetRewardTime = lastGetRewardTime;
	}

	public String getDecoration() {
		return decoration;
	}

	public void setDecoration(String decoration) {
		this.decoration = decoration;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getUnionName() {
		return unionName;
	}

	public void setUnionName(String unionName) {
		this.unionName = unionName;
	}

	public BigInteger getTotalAbility() {
		return totalAbility;
	}

	public void setTotalAbility(BigInteger totalAbility) {
		this.totalAbility = totalAbility;
	}

	public List<UserPatrons> getPatronsList() {
		return patronsList;
	}

	public void setPatronsList(List<UserPatrons> patronsList) {
		this.patronsList = patronsList;
	}

	public boolean isContainsPatrons(int patronsId){
		UserPatrons userPatrons = getUserPatrons(patronsId);
		return null != userPatrons;
	}

	public void addUserPatrons(UserPatrons userPatrons){
		replacePatrons(userPatrons);
	}

	public void replacePatrons(UserPatrons userPatrons){
		UserPatrons oldPatrons = getUserPatrons(userPatrons.getPatronsId());
		if(null != oldPatrons) {
			patronsList.remove(oldPatrons);
		}
		patronsList.add(userPatrons);
	}

	public UserPatrons getUserPatrons(int patronsId){
		for(UserPatrons userPatrons : patronsList){
			if(userPatrons.getPatronsId() == patronsId){
				return userPatrons;
			}
		}
		return null;
	}
}
